package com.bw.Controller;

import com.bw.Service.StrService;
import com.bw.bean.Str;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @BelongsProject: lianxiyuekao
 * @BelongsPackage: com.bw.Controller
 * @Author: wuxiaopeng
 * @CreateTime: 2024-09-29  14:06
 * @Description: TODO
 * @Version: 1.0
 */
@RestController
public class StrController {
    @Autowired
    StrService strService;

    @RequestMapping("list1")
    public Map getlist1(){
        List<Str> list=strService.getlist();
        return SugarUtil.getPieData(list);
    }

    @RequestMapping("list2")
    public Map getlist2(){
        List<Str> list=strService.getlist2();
        return SugarUtil.getBarData(list);
    }

    @RequestMapping("list3")
    public Map getlist3(){
        Double num=strService.getlist3();
        return SugarUtil.getFlipNumberData(num);
    }

    @RequestMapping("list4")
    public Map getlist4(){
        List<Str> list=strService.getlist4();
        List<String> list1 = new ArrayList<>();
        list1.add("名称");
        list1.add("总金额");
        return SugarUtil.getTablePlayData(list1,list);
    }
}
